package com.klikmee.sms.chat.web.dao;

import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
import com.klikmee.sms.services.chat.model.Template;

public class TemplateDAO extends AbstractDAO<Template> {

	@PersistenceContext
	private EntityManager em;
	
	public TemplateDAO() {
		super(Template.class);
	}

	@SuppressWarnings("unchecked")
	public List<Template> findAll() {
		List<Template> sq = null;
		try {
			sq = (List<Template>) em.createNamedQuery("Template.findAll").getResultList();
		} catch (NoResultException e) {

		}

		return sq;
	}
	
	@SuppressWarnings("unchecked")
	public List<Template> findAllActive() {
		List<Template> sq = null;
		try {
			sq = (List<Template>) em.createNamedQuery("Template.findAllActive").getResultList();
		} catch (NoResultException e) {

		}

		return sq;
	}
}
